package eventsocket

// Set - Helper that you can use to execute SET application against active ESL session
func (sc *Connection) ExecuteSet(key string, value string, sync bool) (m *Event, err error) {
	return sc.Execute("set", key+"="+value, sync)
}

// ExecuteHangup - Helper desgned to help with executing Answer against active ESL session
func (sc *Connection) ExecuteAnswer(args string, sync bool) (m *Event, err error) {
	return sc.Execute("answer", args, sync)
}

// ExecuteHangup - Helper desgned to help with executing Hangup against active ESL session
func (sc *Connection) ExecuteHangup(uuid string, args string) (m *Event, err error) {
	if uuid != "" {
		return sc.ExecuteUUID(uuid, "hangup", args)
	}

	return sc.Execute("hangup", args, sync)
}

// BgApi - Helper designed to attach api in front of the command so that you do not need to write it
func (sc *Connection) Api(command string) error {
	return sc.Send("api " + command)
}

// BgApi - Helper designed to attach bgapi in front of the command so that you do not need to write it
func (sc *Connection) BgApi(command string) error {
	return sc.Send("bgapi " + command)
}

// Connect - Helper designed to help you handle connection. Each outbound server when handling needs to connect e.g. accept
// connection in order for you to do answer, hangup or do whatever else you wish to do
func (sc *Connection) Connect() error {
	return sc.Send("connect")
}

// Exit - Used to send exit signal to ESL. It will basically hangup call and close connection
func (sc *Connection) Exit() error {
	return sc.Send("exit")
}
